<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <h2>一元运算符</h2>
    <ul>
        <li>+: +a，实际上没有任何意义</li>
        <li>-: -a，取a的相反数</li>
        <li>++: a ++ | ++ a 表示，a = a + 1;</li>
        <li>--: a -- | -- a 表示，a = a - 1;</li>
    </ul>
</body>
<script>
    let a = 1;
    a ++;
    console.log("a = ",a); // 2

    let b = 1;
    ++ b;
    console.log("b = ",b); // 2

   

    // 把a和b赋值为0
    a = 0;
    b = 0;

     // i++ 是先取值,然后再自增;++ i 先自增,再取值
    let c = ++ a + b ++ + a ++;
    console.log("c = ",c); // 2
    console.log("a = ",a); // 2
    console.log("b = ",b); // 1
    
</script>
</html>